home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Amiga Classic Collection
/
The Amiga Classic Collection - Disc 1.iso
/
Education
/
ED16-CrosswordCreator.DMS
/
ED16-CrosswordCreator.adf
/
Source
/
CPCPrint.mod
< prev
next >
Wrap
Text File
|
1991-07-13
|
3KB
|
156 lines
IMPLEMENTATION MODULE CPCPrint;
IMPORT ASCII;
IMPORT CPCMenu;
IMPORT CPCGlobal;
IMPORT CrossFont;
IMPORT GraphicsD,GraphicsL;
IMPORT IntuiIO;
IMPORT IntuitionD,IntuitionL;
IMPORT String;
IMPORT SYSTEM;
CONST
xsize=8;
ysize=8;
spcs=" ";
smallxsize=7;
smallysize=6;
VAR
crossfont: GraphicsD.TextFontPtr;
initialized: BOOLEAN;
cursorx,cursory: INTEGER;
PROCEDURE Print(a: ARRAY OF CHAR; n: INTEGER);
BEGIN
GraphicsL.SetFont(CPCGlobal.rastport,CPCGlobal.topaz);
IntuiIO.Print(CPCGlobal.window,a,cursorx*xsize,cursory*ysize+CPCGlobal.yoff);
cursory:=cursory+n;
IF n=0 THEN
cursorx:=cursorx+String.Length(a);
ELSE
cursorx:=0;
END;
END Print;
PROCEDURE PrintAtC(cx,cy: INTEGER; c: CHAR);
VAR
a: ARRAY[0..1] OF CHAR;
BEGIN
cursorx:=cx;
cursory:=cy;
a[0]:=c;
a[1]:=ASCII.nul;
Print(a,0);
END PrintAtC;
PROCEDURE PrintAtS(cx,cy: INTEGER; a: ARRAY OF CHAR);
BEGIN
cursorx:=cx;
cursory:=cy;
Print(a,0);
END PrintAtS;
PROCEDURE ClrLine(l: INTEGER);
BEGIN
PrintAtS(0,l,spcs);
cursorx:=0;
END ClrLine;
PROCEDURE Cls;
BEGIN
GraphicsL.Move(IntuiIO.ScreenRastPort(CPCGlobal.screen),0,10);
GraphicsL.ClearScreen(IntuiIO.ScreenRastPort(CPCGlobal.screen));
cursorx:=0;
cursory:=0;
IntuitionL.ShowTitle(SYSTEM.CAST(IntuitionD.ScreenPtr,CPCGlobal.screen),TRUE);
END Cls;
PROCEDURE ShowAll;
VAR
xloop,yloop: INTEGER;
line: CPCGlobal.LString;
BEGIN
FOR yloop:=1 TO CPCGlobal.ymax DO
FOR xloop:=1 TO CPCGlobal.xmax DO
IF (CPCGlobal.text[xloop,yloop]=ASCII.nul) THEN
line[xloop-1]:=CPCGlobal.blankC;
ELSE
line[xloop-1]:=CPCGlobal.text[xloop,yloop];
END;
END;
line[xloop-1]:=ASCII.nul;
GraphicsL.SetAPen(CPCGlobal.rastport,1);
GraphicsL.SetFont(CPCGlobal.rastport,crossfont);
IntuiIO.Print(CPCGlobal.window,line,0,(yloop-1)*smallysize+CPCGlobal.yoff);
END;
END ShowAll;
PROCEDURE SmallPrintAtS(x,y: INTEGER; s: ARRAY OF CHAR);
BEGIN
GraphicsL.SetAPen(CPCGlobal.rastport,1);
GraphicsL.SetFont(CPCGlobal.rastport,crossfont);
IntuiIO.Print(CPCGlobal.window,s,x*smallxsize,
y*smallysize+CPCGlobal.yoff);
END SmallPrintAtS;
PROCEDURE SmallPrintAtC(x,y: INTEGER; c: CHAR);
VAR
str: ARRAY[0..1] OF CHAR;
BEGIN
str[0]:=c;
str[1]:="\o";
SmallPrintAtS(x,y,str);
END SmallPrintAtC;
PROCEDURE CharPos(VAR cx,cy: INTEGER);
BEGIN
cx:=(cx DIV smallxsize);
cy:=((cy-CPCGlobal.yoff) DIV smallysize);
IF (cx<0) OR (cx>CPCGlobal.xmax-1) THEN
cx:=-1;
cy:=-1;
END;
IF (cy<0) OR (cy>CPCGlobal.ymax-1) THEN
cx:=-1;
cy:=-1;
END;
END CharPos;
BEGIN
IF NOT initialized THEN
initialized:=TRUE;
crossfont:=CrossFont.CreateFont();
END;
cursorx:=0;
cursory:=0;
END CPCPrint.